﻿using Restful_Api.Entities;
using Restful_Api.ValidationAttributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Restful_Api.Models
{
    public class EmployeeAddDto : EmployeeAddorUpdateBase, IValidatableObject
    {
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            //（返回的错误信息，有谁引发的错误）
            if (FistName == LastName)
                yield return new ValidationResult("姓和名不能一样", new[] { nameof(FistName), nameof(LastName) });

        }
    }
}
